home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Almathera Ten Pack 3: CDPD 3
/
Almathera Ten on Ten - Disc 3: CDPD3.iso
/
fish
/
001-100
/
001-025
/
023
/
ver30
/
gnucmds.c
< prev
next >
Wrap
C/C++ Source or Header
|
1995-03-17
|
2KB
|
111 lines
/*
* Name: MicroEMACS
* GNU compatible commands
* Version: 29
* Last edit: 19-Apr-86
* By: {sun, amdahl, mtxinu}!rtech!daveb
*
* This file contains new commands written for GNU emacs compatibility.
*
* suspend(), replacing jeffexit().
* savebuffs(), new.
* savequit(), new.
* notmodified(), new.
* findalternate(), new.
* scrollother(), new.
*/
#include "def.h"
/*
* GNU style suspend. Asks to save all dirty buffs, then starts a CLI.
* Bound to "C-Z" and "X-C-Z"
*
* Supercedes "jeffexit" X-C-Z too.
*/
suspend(f, n, k)
{
if(ABORT != savebuffs(0, 0, KRANDOM))
return (spawncli(f, n, KRANDOM));
else
return (ABORT);
}
/*
* GNU compatible buffer save routine.
* Scan all buffers and ask for disposition.
* Does not affect display. X-S
* (daveb)
*/
savebuffs(f, n, k)
{
char buf[ 80 ];
register int s;
register BUFFER *bp;
BUFFER *oldbp = curbp;
int considered = FALSE;
int row = ttrow;
int col = ttcol;
for( bp = bheadp; bp != NULL; bp = bp->b_bufp )
if (bp->b_bname[0]!=' ' && bp->b_fname[0]!='\0'
&& (bp->b_flag&BFCHG) != 0) {
considered = TRUE;
strcpy( buf, "Save file ");
strcat( buf, bp->b_fname );
s = eyesno( buf, bp->b_fname);
if (s == ABORT)
return (ABORT);
if (s == TRUE) {
curbp = bp;
filesave(f, n, KRANDOM);
ttmove( row, col );
ttflush();
}
}
if(!considered)
eprintf("(No files need saving)");
curbp = oldbp;
ttmove( row, col );
ttflush();
return(TRUE);
}
/*
* GNU style exit: query on every dirty buffer, then exit. X-C-C
*/
savequit(f, n, k)
{
if(ABORT != savebuffs(0, 0, KRANDOM))
quit(f, n, k);
return( ABORT );
}
/*
* Turn off the dirty bit on this buffer. M-~
*/
notmodified(f, n, k)
{
register WINDOW *wp;
curbp->b_flag &= ~BFCHG;
wp = wheadp; /* Update mode lines. */
while (wp != NULL) {
if (wp->w_bufp == curbp)
wp->w_flag |= WFMODE;
wp = wp->w_wndp;
}
eprintf("Modification-flag cleared");
return (TRUE);
}
/*
* Scroll the other window. On C-M-V. Works OK (daveb).
*/
scrollother(f, n, k)
{
nextwind(0, 0, KRANDOM);
forwpage(f, n, k);
prevwind(0, 0, KRANDOM);
}